
<?php

/**
 * This is the model class for table "tbl_baokim".
 *
 * The followings are the available columns in table 'tbl_baokim':
 * @property integer $id
 * @property integer $uid
 * @property string $transaction_id
 * @property integer $transaction_status
 * @property integer $total_amount
 * @property string $customer_name
 * @property integer $customer_address
 * @property integer $table_id
 * @property string $action_table
 * @property integer $status
 * @property string $create_time
 * @property string $update_time
 */
class Baokim extends CActiveRecord
{
    /**
     * Returns the static model of the specified AR class.
     * @param string $className active record class name.
     * @return Baokim the static model class
     */
    public static function model($className=__CLASS__)
    {
        return parent::model($className);
    }

    /**
     * @return string the associated database table name
     */
    public function tableName()
    {
        return 'tbl_baokim';
    }

    /**
     * @return array validation rules for model attributes.
     */
    public function rules()
    {
        // NOTE: you should only define rules for those attributes that
        // will receive user inputs.
        return array(
            array('uid, transaction_id, transaction_status, total_amount, customer_name, customer_address, status, create_time, update_time', 'required'),
            array('uid, transaction_status, total_amount, customer_address, table_id, status', 'numerical', 'integerOnly'=>true),
            array('transaction_id, action_table', 'length', 'max'=>20),
            array('customer_name', 'length', 'max'=>30),
            // The following rule is used by search().
            // Please remove those attributes that should not be searched.
            array('id, uid, transaction_id, transaction_status, total_amount, customer_name, customer_address, table_id, action_table, status, create_time, update_time', 'safe', 'on'=>'search'),
        );
    }

    /**
     * @return array relational rules.
     */
    public function relations()
    {
        // NOTE: you may need to adjust the relation name and the related
        // class name for the relations automatically generated below.
        return array(
        );
    }

    /**
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels()
    {
        return array(
            'id' => 'ID',
            'uid' => 'Uid',
            'transaction_id' => 'Transaction',
            'transaction_status' => 'Transaction Status',
            'total_amount' => 'Total Amount',
            'customer_name' => 'Customer Name',
            'customer_address' => 'Customer Address',
            'table_id' => 'Table',
            'action_table' => 'Action Table',
            'status' => 'Status',
            'create_time' => 'Create Time',
            'update_time' => 'Update Time',
        );
    }

    /**
     * Retrieves a list of models based on the current search/filter conditions.
     * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
     */
    public function search()
    {
        // Warning: Please modify the following code to remove attributes that
        // should not be searched.

        $criteria=new CDbCriteria;

        $criteria->compare('id',$this->id);
        $criteria->compare('uid',$this->uid);
        $criteria->compare('transaction_id',$this->transaction_id,true);
        $criteria->compare('transaction_status',$this->transaction_status);
        $criteria->compare('total_amount',$this->total_amount);
        $criteria->compare('customer_name',$this->customer_name,true);
        $criteria->compare('customer_address',$this->customer_address);
        $criteria->compare('table_id',$this->table_id);
        $criteria->compare('action_table',$this->action_table,true);
        $criteria->compare('status',$this->status);
        $criteria->compare('create_time',$this->create_time,true);
        $criteria->compare('update_time',$this->update_time,true);

        return new CActiveDataProvider($this, array(
            'criteria'=>$criteria,
        ));
    }
}